<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>首页</title>
    <script src="https://cdn.bootcss.com/vue/2.6.5/vue.common.dev.js"></script>
    <script src="http://cdn.bootcss.com/vue-resource/1.3.4/vue-resource.js"></script>
    <script src="https://unpkg.com/element-ui@2.0.5/lib/index.js"></script>
</head>
<body>
<div id="mainMenu">
    <a th:href="@{/page/JobManager}">定时任务管理</a>
    <a th:href="@{/swagger-ui.html}">swagger2文档</a>
    <a th:href="@{/page/sys/generator}">代码生成</a>
    <el-button type="primary" @click="logout">注销</el-button>
</div>
</body>
<script>
    const baseUrl = "http://localhost:8080/";
    var vue = new Vue({
        el:"#mainMenu",
        data: {
            logoutUrl: 'user/logout'
        },
        methods: {
            //登录
            logout: function() {
                debugger
                var than = this;
                this.$http.post(baseUrl+this.logoutUrl,{},{emulateJSON:true}).then(function(res){
                    if (res.data.code == 200){
                        window.location = "/login"
                    }else{
                        than.$message({message: res.data.message, type: 'warning'});
                    }
                },function(){
                    than.$message({message: '请求失败', type: 'error'});
                });
            },
        },



    });
</script>

</html>